﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;


namespace LoveEat.MODEL.WeChat
{
    #region 卡券类定义

    /// <summary>
    /// 卡券共有类
    /// </summary>
    [Serializable]
    [DataContract]
    public class WeChatCommonCardMain
    {
        /// <summary>
        /// 基本的卡券数据
        /// </summary>
        [DataMember(Name = "base_info")]
        [Display(Name = "基本的卡券数据")]
        public WeChatCCardBaseInfo base_info { get; set; }

        /// <summary>
        /// 高级的卡券数据
        /// </summary>
        [DataMember(Name = "advanced_info")]
        [Display(Name = "高级的卡券数据")]
        public WeChatCCardAdvancedInfo advanced_info { get; set; }
    }

    /// <summary>
    /// 微信卡券通用定义
    /// </summary>
    [Serializable]
    [DataContract]
    public class WechatCommonCard
    {
        /// <summary>
        /// 卡券类型
        /// </summary>
        [DataMember(Name = "card_type")]
        [Display(Name = "卡券类型")]
        public string card_type { get; set; }

        /// <summary>
        /// 团购券主体
        /// </summary>
        [DataMember(Name = "groupon")]
        [Display(Name = "团购券主体")]
        public GrouponCardMain groupon { get; set; }

        /// <summary>
        /// 现金券主体
        /// </summary>
        [DataMember(Name = "cash")]
        [Display(Name = "现金券主体")]
        public CashCardMain cash { get; set; }

        /// <summary>
        /// 折扣券主体
        /// </summary>
        [DataMember(Name = "discount")]
        [Display(Name = "卡券主体")]
        public DiscountCardMain discount { get; set; }

        /// <summary>
        /// 兑换券主体
        /// </summary>
        [DataMember(Name = "gift")]
        [Display(Name = "兑换券主体")]
        public GiftCardMain gift { get; set; }

        /// <summary>
        /// 通用券主体
        /// </summary>
        [DataMember(Name = "general_coupon")]
        [Display(Name = "通用券主体")]
        public GeneralCouponCardMain general_coupon { get; set; }
    }

    /// <summary>
    /// 单个卡券专用通用定义
    /// </summary>
    [Serializable]
    [DataContract]
    public class WechatCommonSingleCard : WechatCommonCard
    {
        /// <summary>
        /// 卡券类型
        /// </summary>
        [DataMember(Name = "card_type")]
        [Display(Name = "卡券类型")]
        public WechatCommonCardType CurrentCardType { get; set; }

        /// <summary>
        /// 卡券ID
        /// </summary>
        [DataMember(Name = "card_id")]
        [Display(Name = "卡券ID")]
        public string card_id { get; set; }
    }

    /// <summary>
    /// 卡券列表集合
    /// </summary>
    [Serializable]
    [DataContract]
    public class WeChatCommonCardCollection
    {
        /// <summary>
        /// 团购券列表
        /// </summary>
        [DataMember(Name = "GrouponCardList")]
        [Display(Name = "团购券列表")]
        public List<GrouponCardMain> GrouponCardList { get; set; }

        /// <summary>
        /// 代金券列表
        /// </summary>
        [DataMember(Name = "CashCardList")]
        [Display(Name = "代金券列表")]
        public List<CashCardMain> CashCardList { get; set; }

        /// <summary>
        /// 折扣券列表
        /// </summary>
        [DataMember(Name = "DiscountCardList")]
        [Display(Name = "折扣券列表")]
        public List<DiscountCardMain> DiscountCardList { get; set; }

        /// <summary>
        /// 兑换券列表
        /// </summary>
        [DataMember(Name = "GiftCardList")]
        [Display(Name = "兑换券列表")]
        public List<GiftCardMain> GiftCardList { get; set; }

        /// <summary>
        /// 通用券列表
        /// </summary>
        [DataMember(Name = "GeneralCouponCardList")]
        [Display(Name = "通用券列表")]
        public List<GeneralCouponCardMain> GeneralCouponCardList { get; set; }

    }

    #region 团购券 GROUPON
    /// <summary>
    /// 团购券主体属性
    /// </summary>
    [Serializable]
    [DataContract]
    public class GrouponCardMain : WeChatCommonCardMain
    {
        /// <summary>
        /// 团购券专用，团购详情
        /// 例如：双人套餐\n -进口红酒一支。\n孜然牛肉一份
        /// </summary>
        [DataMember(Name = "deal_detail")]
        [Display(Name = "团购详情")]
        public string deal_detail { get; set; }
    }
    #endregion

    #region 代金券 Cash
    /// <summary>
    /// 代金券属性主体
    /// </summary>
    [Serializable]
    [DataContract]
    public class CashCardMain : WeChatCommonCardMain
    {
        /// <summary>
        /// 代金券专用，表示起用金额（单位为分）,如果无起用门槛则填0
        /// </summary>
        [DataMember(Name = "least_cost")]
        [Display(Name = "起用金额")]
        public int least_cost { get; set; }

        /// <summary>
        /// 代金券专用，表示减免金额。（单位为分）
        /// </summary>
        [DataMember(Name = "reduce_cost")]
        [Display(Name = "减免金额")]
        public int reduce_cost { get; set; }
    }
    #endregion

    #region 折扣券 DISCOUNT
    /// <summary>
    /// 折扣券属性主体
    /// </summary>
    [Serializable]
    [DataContract]
    public class DiscountCardMain : WeChatCommonCardMain
    {
        /// <summary>
        /// 折扣券专用，表示打折额度（百分比）。填30就是七折
        /// </summary>
        [DataMember(Name = "discount")]
        [Display(Name = "打折额度")]
        public int discount { get; set; }
    }
    #endregion

    #region 兑换券 GIFT
    /// <summary>
    /// 礼品券属性主体
    /// </summary>
    [Serializable]
    [DataContract]
    public class GiftCardMain : WeChatCommonCardMain
    {
        /// <summary>
        /// 礼品券专用，填写礼品的名称
        /// </summary>
        [DataMember(Name = "gift")]
        [Display(Name = "礼品名称")]
        public string gift { get; set; }
    }
    #endregion

    #region 优惠券 GENERAL_COUPON
    /// <summary>
    /// 优惠券属性主体
    /// </summary>
    [Serializable]
    [DataContract]
    public class GeneralCouponCardMain : WeChatCommonCardMain
    {
        /// <summary>
        /// 优惠券专用，填写优惠详情
        /// </summary>
        [DataMember(Name = "default_detail")]
        [Display(Name = "优惠详情")]
        public string default_detail { get; set; }
    }
    #endregion

    #endregion

    #region BaseInfo 定义
    /// <summary>
    /// 卡券商品信息
    /// </summary>
    [Serializable]
    [DataContract]
    public class WechatCardSku
    {

        /// <summary>
        /// 库存现存数量, 上限为100000000
        /// </summary>
        [DataMember(Name = "quantity")]
        [Display(Name = "库存现存数量")]
        public int quantity { get; set; }

        /// <summary>
        /// total_quantity, 上限为100000000
        /// </summary>
        [DataMember(Name = "total_quantity")]
        [Display(Name = "库存总量")]
        public int total_quantity { get; set; }
    }

    /// <summary>
    /// 卡券使用日期，有效期的信息
    /// </summary>
    [Serializable]
    [DataContract]
    public class WechatCardDateInfo
    {
        /// <summary>
        /// 使用时间的类型
        /// DATE_TYPE_FIX_TIME_RANGE ：固定日期区间
        /// DATE_TYPE_FIX_TERM：固定时长（自领取后按天算）
        /// </summary>
        [DataMember(Name = "type")]
        [Display(Name = "使用时间的类型。 ")]
        public string type { get; set; }

        /// <summary>
        /// 固定日期区间专用，表示起用时间
        /// type为DATE_TYPE_FIX_TIME_RANGE时专用，表示起用时间。
        /// 从1970年1月1日00:00:00至起用时间的秒数，最终需转换为字符串形态传入。（东八区时间，单位为秒）
        /// </summary>
        [DataMember(Name = "begin_timestamp")]
        [Display(Name = "固定日期区间专用，表示起用时间")]
        public UInt32? begin_timestamp { get; set; }

        /// <summary>
        /// 结束时间。
        /// 表示结束时间，建议设置为截止日期的23:59:59过期。（东八区时间，单位为秒）
        /// 设置了fixed_term卡券，当时间达到end_timestamp时卡券统一过期
        /// </summary>
        [DataMember(Name = "end_timestamp")]
        [Display(Name = "固定日期区间专用，表示结束时间。")]
        public UInt32? end_timestamp { get; set; }

        /// <summary>
        /// 固定时长专用，表示自领取后多少天内有效。（单位为天）
        /// 不支持填写0
        /// </summary>
        [DataMember(Name = "fixed_term")]
        [Display(Name = "固定时长专用，表示自领取后多少天内有效")]
        public int? fixed_term { get; set; }

        /// <summary>
        /// 固定时长专用，表示自领取后多少天开始生效。（单位为天）
        /// 领取后当天生效填写0
        /// </summary>
        [DataMember(Name = "fixed_begin_term")]
        [Display(Name = "固定时长专用，表示自领取后多少天开始生效。")]
        public int? fixed_begin_term { get; set; }
    }

    /// <summary>
    /// 基本的卡券数据
    /// </summary>
    [Serializable]
    [DataContract]
    public class WeChatCCardBaseInfo
    {
        /// <summary>
        /// 卡券的商户logo 建议像素为300*300
        /// </summary>
        [DataMember(Name = "logo_url")]
        [Display(Name = "卡券的商户logo")]
        public string logo_url { get; set; }

        /// <summary>
        /// appid
        /// </summary>
        [DataMember(Name = "appid")]
        [Display(Name = "appid")]
        public string appid { get; set; }

        /// <summary>
        /// Code展示类型
        /// </summary>
        /// <remarks>
        /// "CODE_TYPE_TEXT"，文本；
        /// "CODE_TYPE_BARCODE"，一维码 ；
        /// "CODE_TYPE_QRCODE"，二维码；
        /// "CODE_TYPE_ONLY_QRCODE",二维码无code显示；
        /// "CODE_TYPE_ONLY_BARCODE",一维码无code显示；
        /// CODE_TYPE_NONE，不显示code和条形码类型，须开发者传入"立即使用"自定义cell完成线上券核销
        /// </remarks>
        [DataMember(Name = "code_type")]
        [Display(Name = "Code展示类型")]
        public string code_type { get; set; }

        /// <summary>
        /// 商户名字, 字数上限为12个汉字
        /// </summary>
        [DataMember(Name = "brand_name")]
        [Display(Name = "商户名字")]
        public string brand_name { get; set; }

        /// <summary>
        /// 卡券名, 字数上限为9个汉字
        /// </summary>
        [DataMember(Name = "title")]
        [Display(Name = "卡券名")]
        public string title { get; set; }

        /// <summary>
        /// 券名, 字数上限为18个汉字
        /// </summary>
        [DataMember(Name = "sub_title")]
        [Display(Name = "券名")]
        public string sub_title { get; set; }

        /// <summary>
        /// 券颜色。按色彩规范标注填写Color010-Color100
        /// </summary>
        [DataMember(Name = "color")]
        [Display(Name = "券颜色")]
        public string color { get; set; }

        /// <summary>
        /// 使用提醒 字数上限为16个汉字
        /// </summary>
        [DataMember(Name = "notice")]
        [Display(Name = "使用提醒")]
        public string notice { get; set; }

        /// <summary>
        ///     使用说明。长文本描述，可以分行
        /// </summary>
        [DataMember(Name = "description")]
        [Display(Name = "使用说明。长文本描述，可以分行")]
        public string description { get; set; }

        /// <summary>
        ///     商品信息。
        /// </summary>
        [DataMember(Name = "sku")]
        [Display(Name = "商品信息。")]
        public WechatCardSku sku { get; set; }

        /// <summary>
        /// 使用日期，有效期的信息。
        /// </summary>
        [DataMember(Name = "date_info")]
        [Display(Name = "使用日期，有效期的信息。")]
        public WechatCardDateInfo date_info { get; set; }

        /// <summary>
        /// 是否自定义code码
        /// 填写true或false，默认为false。
        /// 通常自有优惠码系统的开发者选择自定义Code码，
        /// 并在卡券投放时带入Code码
        /// </summary>
        [DataMember(Name = "use_custom_code")]
        [Display(Name = "是否自定义code码。 ")]
        public bool? use_custom_code { get; set; }

        /// <summary>
        /// 是否指定用户领取
        /// 默认为false。通常指定特殊用户群体投放卡券或防止刷券时选择指定用户领取
        /// </summary>
        [DataMember(Name = "bind_openid")]
        [Display(Name = "是否指定用户领取")]
        public bool? bind_openid { get; set; }

        /// <summary>
        /// 客服电话
        /// </summary>
        [DataMember(Name = "service_phone")]
        [Display(Name = "客服电话")]
        public string service_phone { get; set; }

        /// <summary>
        /// 门店位置poiid
        /// 调用POI门店管理接口获取门店位置poiid。具备线下门店的商户为必填
        /// </summary>
        [DataMember(Name = "location_id_list")]
        [Display(Name = "门店位置poiid")]
        public int[] location_id_list { get; set; }

        /// <summary>
        /// 第三方来源名
        /// </summary>
        [DataMember(Name = "source")]
        [Display(Name = "第三方来源名")]
        public string source { get; set; }

        /// <summary>
        /// 自定义跳转外链的入口名字
        /// </summary>
        [DataMember(Name = "custom_url_name")]
        [Display(Name = "自定义跳转外链的入口名字")]
        public string custom_url_name { get; set; }

        /// <summary>
        /// 卡券顶部居中的按钮
        /// 仅在卡券状态正常(可以核销)时显示，建议开发者设置此按钮时code_type选择CODE_TYPE_NONE类型
        /// </summary>
        [DataMember(Name = "center_title")]
        [Display(Name = "卡券顶部居中的按钮")]
        public string center_title { get; set; }

        /// <summary>
        /// 显示在入口下方的提示语
        /// 仅在卡券状态正常(可以核销)时显示
        /// </summary>
        [DataMember(Name = "center_sub_title")]
        [Display(Name = "显示在入口下方的提示语")]
        public string center_sub_title { get; set; }

        /// <summary>
        /// 顶部居中的url
        /// 仅在卡券状态正常(可以核销)时显示
        /// </summary>
        [DataMember(Name = "center_url")]
        [Display(Name = "顶部居中的url")]
        public string center_url { get; set; }

        /// <summary>
        /// 自定义跳转的URL
        /// </summary>
        [DataMember(Name = "custom_url")]
        [Display(Name = "自定义跳转的URL")]
        public string custom_url { get; set; }

        /// <summary>
        /// 显示在入口右侧的提示语
        /// </summary>
        [DataMember(Name = "custom_url_sub_title")]
        [Display(Name = "显示在入口右侧的提示语")]
        public string custom_url_sub_title { get; set; }

        /// <summary>
        /// 营销场景的自定义入口名称
        /// </summary>
        [DataMember(Name = "promotion_url_name")]
        [Display(Name = "营销场景的自定义入口名称")]
        public string promotion_url_name { get; set; }

        /// <summary>
        /// 营销场景入口跳转外链的地址链接
        /// </summary>
        [DataMember(Name = "promotion_url")]
        [Display(Name = "营销场景入口跳转外链的地址链接")]
        public string promotion_url { get; set; }

        /// <summary>
        /// 显示在营销入口右侧的提示语
        /// </summary>
        [DataMember(Name = "promotion_url_sub_title")]
        [Display(Name = "显示在营销入口右侧的提示语")]
        public string promotion_url_sub_title { get; set; }

        /// <summary>
        /// 每人最大领取次数
        /// 不填写默认为50
        /// </summary>
        [DataMember(Name = "get_limit")]
        [Display(Name = "每人最大领取次数")]
        public int? get_limit { get; set; }

        /// <summary>
        /// 卡券领取页面是否可分享
        /// </summary>
        [DataMember(Name = "can_share")]
        [Display(Name = "卡券领取页面是否可分享")]
        public bool? can_share { get; set; }

        /// <summary>
        /// 卡券是否可转赠
        /// </summary>
        [DataMember(Name = "can_give_friend")]
        [Display(Name = "	卡券是否可转赠")]
        public bool? can_give_friend { get; set; }

        /// <summary>
        /// 卡券状态 
        /// CARD_STATUS_NOT_VERIFY”,待审核；“CARD_STATUS_VERIFY_FAIL”,审核失败；
        /// “CARD_STATUS_VERIFY_OK”，通过审核；“CARD_STATUS_DELETE”，卡券被商户删除；
        /// “CARD_STATUS_DISPATCH”，在公众平台投放过的卡券
        /// </summary>
        [DataMember(Name = "status")]
        [Display(Name = "卡券状态")]
        public string status { get; set; }

        /// <summary>
        /// 卡券ID
        /// </summary>
        [DataMember(Name = "id")]
        [Display(Name = "卡券ID")]
        public string id { get; set; }

        /// <summary>
        /// 卡券使用次数限制
        /// </summary>
        [DataMember(Name = "use_limit")]
        [Display(Name = "卡券使用次数限制")]
        public int use_limit { get; set; }
    }
    #endregion

    #region Advanced_info定义
    /// <summary>
    /// 使用门槛（条件）字段
    /// </summary>
    [Serializable]
    [DataContract]
    public class UseCondition
    {
        /// <summary>
        /// 指定可用的商品类目，仅用于代金券类型，填入后将在券面拼写指定xx可用
        /// </summary>
        [DataMember(Name = "accept_category")]
        [Display(Name = "指定可用的商品类目")]
        public string accept_category { get; set; }

        /// <summary>
        /// 指定不可用的商品类目，仅用于代金券类型，填入后将在券面拼写指定xx不可用。
        /// </summary>
        [DataMember(Name = "reject_category")]
        [Display(Name = "指定不可用的商品类目")]
        public string reject_category { get; set; }

        /// <summary>
        /// 满减门槛字段，可用于兑换券和代金券，填入后将在全面拼写消费满xx元可用。
        /// </summary>
        [DataMember(Name = "least_cost")]
        [Display(Name = "满减门槛字段")]
        public int? least_cost { get; set; }

        /// <summary>
        /// 购买xx可用类型门槛，仅用于兑换，填入后自动拼写购买xxx可用
        /// </summary>
        [DataMember(Name = "object_use_for")]
        [Display(Name = "购买xx可用类型门槛")]
        public string object_use_for { get; set; }

        /// <summary>
        /// 不可以与其他类型共享门槛，填写false时系统将在使用须知里拼写不可与其他优惠共享，默认为true
        /// </summary>
        [DataMember(Name = "can_use_with_other_discount")]
        [Display(Name = "不可以与其他类型共享门槛")]
        public bool? can_use_with_other_discount { get; set; }
    }

    /// <summary>
    /// 封面摘要结构体名称
    /// </summary>
    [Serializable]
    [DataContract]
    public class AbStractInfo
    {
        /// <summary>
        /// 封面摘要简介
        /// </summary>
        [DataMember(Name = "abstract")]
        [Display(Name = "封面摘要简介")]
        public string @abstract { get; set; }

        /// <summary>
        /// 封面图片列表，仅支持填入一个封面图片链接，
        /// 上传图片接口上传获取图片获得链接，填写非CDN链接会报错，
        /// 并在此填入。建议图片尺寸像素850*350
        /// </summary>
        [DataMember(Name = "icon_url_list")]
        [Display(Name = "封面图片列表")]
        public string[] icon_url_list { get; set; }
    }

    /// <summary>
    /// 图文信息
    /// </summary>
    [Serializable]
    [DataContract]
    public class TextImageInfo
    {
        /// <summary>
        /// 图片链接，必须调用上传图片接口上传图片获得链接，并在此填入，否则报错
        /// </summary>
        [DataMember(Name = "image_url")]
        [Display(Name = "图片链接")]
        public string image_url { get; set; }

        /// <summary>
        /// 图文描述，5000字以内
        /// </summary>
        [DataMember(Name = "text")]
        [Display(Name = "图文描述")]
        public string text { get; set; }
    }

    /// <summary>
    /// 使用时段限制
    /// </summary>
    [Serializable]
    [DataContract]
    public class TimeLimitInfo
    {
        /// <summary>
        ///	限制类型枚举值
        /// MONDAY 周一 TUESDAY 周二 WEDNESDAY 周三 THURSDAY 
        /// 周四 FRIDAY 周五 SATURDAY 周六 SUNDAY 周日 
        /// 此处只控制显示，不控制实际使用逻辑，不填默认不显示
        /// </summary>
        [DataMember(Name = "@type")]
        [Display(Name = "限制类型枚举值")]
        public string @type { get; set; }

        /// <summary>
        /// 开始小时数值 当前type类型下的起始时间（小时），如当前结构体内填写了MONDAY，
        /// 此处填写了10，则此处表示周一 10:00可用
        /// </summary>
        [DataMember(Name = "begin_hour")]
        [Display(Name = "开始小时数值")]
        public int? begin_hour { get; set; }

        /// <summary>
        /// 开始分钟数值 当前type类型下的起始时间（分钟），
        /// 如当前结构体内填写了MONDAY，begin_hour填写10，此处填写了59，则此处表示周一 10:59可用
        /// </summary>
        [DataMember(Name = "begin_minute")]
        [Display(Name = "开始分钟数值")]
        public int? begin_minute { get; set; }

        /// <summary>
        /// 结束小时数值 当前type类型下的结束时间（小时），
        /// 如当前结构体内填写了MONDAY，此处填写了20，则此处表示周一 10:00-20:00可用
        /// </summary>
        [DataMember(Name = "end_hour")]
        [Display(Name = "结束小时数值")]
        public int? end_hour { get; set; }

        /// <summary>
        /// 结束分钟数值 当前type类型下的结束时间（分钟），
        /// 如当前结构体内填写了MONDAY，begin_hour填写10，此处填写了59，则此处表示周一 10:59-00:59可用
        /// </summary>
        [DataMember(Name = "end_minute")]
        [Display(Name = "结束分钟数值")]
        public int? end_minute { get; set; }
    }

    /// <summary>
    /// 卡券数据高级信息
    /// </summary>
    [Serializable]
    [DataContract]
    public class WeChatCCardAdvancedInfo
    {
        /// <summary>
        /// 使用门槛（条件）字段
        /// </summary>
        [DataMember(Name = "use_condition")]
        [Display(Name = "使用门槛（条件）字段")]
        public UseCondition use_condition { get; set; }

        /// <summary>
        /// 封面摘要结构体名称
        /// </summary>
        [DataMember(Name = "abstract")]
        [Display(Name = "封面摘要结构体名称")]
        public AbStractInfo @abstract { get; set; }

        /// <summary>
        /// 图文列表，显示在详情内页，优惠券券开发者须至少传入一组图文列表
        /// </summary>
        [DataMember(Name = "text_image_list")]
        [Display(Name = "图文列表")]
        public List<TextImageInfo> text_image_list { get; set; }

        /// <summary>
        /// 使用时段限制
        /// </summary>
        [DataMember(Name = "time_limit")]
        [Display(Name = "使用时段限制")]
        public List<TimeLimitInfo> time_limit { get; set; }

        /// <summary>
        /// 商家服务类型
        /// BIZ_SERVICE_DELIVER 外卖服务；BIZ_SERVICE_FREE_PARK 停车位；
        /// BIZ_SERVICE_WITH_PET 可带宠物；BIZ_SERVICE_FREE_WIFI 免费wifi，可多选
        /// </summary>
        [DataMember(Name = "business_service")]
        [Display(Name = "商家服务类型")]
        public string[] business_service { get; set; }
    }


    #endregion

    #region 返回数据

    /// <summary>
    /// 通用卡券返回结果基础类
    /// </summary>
    [Serializable]
    [DataContract]
    public class WeChatCommonCardModifyResult : WxResultCommonMsg
    {
        /// <summary>
        /// 是否提交审核
        /// </summary>
        [DataMember(Name = "send_check")]
        [Display(Name = "是否提交审核")]
        public string send_check { get; set; }
    }


    /// <summary>
    /// 通用卡券返回结果
    /// </summary>
    [Serializable]
    [DataContract]
    public class WeChatCommonCardResult : WxResultCommonMsg
    {
        /// <summary>
        /// 卡券ID
        /// </summary>
        [DataMember(Name = "card_id")]
        [Display(Name = "卡券ID")]
        public string card_id { get; set; }

        /// <summary>
        /// 卡券内容
        /// </summary>
        [DataMember(Name = "card")]
        [Display(Name = "卡券内容")]
        public WechatCommonCard card { get; set; }
    }

    /// <summary>
    /// 投放卡券返回结果
    /// </summary>
    [Serializable]
    [DataContract]
    public class WeChatCommonCardCreateQrCodeResult : WxResultCommonMsg
    {
        /// <summary>
        /// 获取的二维码ticket，凭借此ticket调用通过ticket换取二维码接口可以在有效时间内换取二维码
        /// </summary>
        [DataMember(Name = "ticket")]
        [Display(Name = "获取的二维码ticket")]
        public string ticket { get; set; }

        /// <summary>
        /// 二维码图片解析后的地址，开发者可根据该地址自行生成需要的二维码图片
        /// </summary>
        [DataMember(Name = "url")]
        [Display(Name = "二维码图片解析后的地址")]
        public string url { get; set; }

        /// <summary>
        /// 二维码显示地址，点击后跳转二维码页面
        /// </summary>
        [DataMember(Name = "show_qrcode_url")]
        [Display(Name = "二维码显示地址")]
        public string show_qrcode_url { get; set; }
    }

    /// <summary>
    /// 核销结果
    /// </summary>
    [Serializable]
    [DataContract]
    public class WeChatCommonCardCosumeResult : WxResultCommonMsg
    {
        /// <summary>
        /// 卡券信息
        /// </summary>
        [DataMember(Name = "card")]
        [Display(Name = "卡券信息")]
        public ConsumeCard card { get; set; }

        /// <summary>
        /// 用户openid
        /// </summary>
        [DataMember(Name = "openid")]
        [Display(Name = "用户openid")]
        public string openid { get; set; }

        [DataMember(Name = "user_card_status")]
        [Display(Name = "当前code对应卡券的状态")]
        public string user_card_status { get; set; }
        /// <summary>
        /// 是否可以核销，true为可以核销，false为不可核销
        /// </summary>
        [DataMember(Name = "can_consume")]
        [Display(Name = "是否可以核销")]
        public string can_consume { get; set; }
    
    }

    /// <summary>
    /// 核销卡券信息
    /// </summary>
    [Serializable]
    [DataContract]
    public class ConsumeCard
    {
        /// <summary>
        /// 卡券ID
        /// </summary>
        [DataMember(Name = "card_id")]
        [Display(Name = "卡券ID")]
        public string card_id { get; set; }

        /// <summary>
        /// 起始使用时间
        /// </summary>
        [DataMember(Name = "begin_time")]
        [Display(Name = "起始使用时间")]
        public int begin_time { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        [DataMember(Name = "end_time")]
        [Display(Name = "结束时间")]
        public int end_time { get; set; }

        /// <summary>
        /// 是否可以核销，true为可以核销，false为不可核销
        /// </summary>
        [DataMember(Name = "can_consume")]
        [Display(Name = "是否可以核销")]
        public string can_consume { get; set; }

        /// <summary>
        /// 当前code对应卡券的状态， NORMAL 正常 CONSUMED 已核销 EXPIRE 已过期 
        /// GIFTING 转赠中 GIFT_TIMEOUT 转赠超时 DELETE 已删除，UNAVAILABLE 已失效； 
        /// code未被添加或被转赠领取的情况则统一报错：invalid serial code
        /// </summary>
        [DataMember(Name = "user_card_status")]
        [Display(Name = "当前code对应卡券的状态")]
        public string user_card_status { get; set; }
    }
    #endregion

    #region 卡券统计
    /// <summary>
    /// 卡券统计基础类
    /// </summary>
    [Serializable]
    [DataContract]
    public class CommonCardStatData
    {
        /// <summary>
        /// 日期信息
        /// </summary>
        [DataMember(Name = "ref_date")]
        [Display(Name = "日期信息")]
        public string ref_date { get; set; }

        /// <summary>
        /// 浏览次数
        /// </summary>
        [DataMember(Name = "view_cnt")]
        [Display(Name = "浏览次数")]
        public int view_cnt { get; set; }

        /// <summary>
        /// 浏览人数
        /// </summary>
        [DataMember(Name = "view_user")]
        [Display(Name = "浏览人数")]
        public int view_user { get; set; }

        /// <summary>
        /// 领取次数
        /// </summary>
        [DataMember(Name = "receive_cnt")]
        [Display(Name = "领取次数")]
        public int receive_cnt { get; set; }

        /// <summary>
        /// 领取人数
        /// </summary>
        [DataMember(Name = "receive_user")]
        [Display(Name = "领取人数")]
        public int receive_user { get; set; }

        /// <summary>
        /// 使用次数
        /// </summary>
        [DataMember(Name = "verify_cnt")]
        [Display(Name = "使用次数")]
        public int verify_cnt { get; set; }

        /// <summary>
        /// 使用人数
        /// </summary>
        [DataMember(Name = "verify_user")]
        [Display(Name = "使用人数")]
        public int verify_user { get; set; }

        /// <summary>
        /// 转赠次数
        /// </summary>
        [DataMember(Name = "given_cnt")]
        [Display(Name = "转赠次数")]
        public int given_cnt { get; set; }

        /// <summary>
        /// 转赠人数
        /// </summary>
        [DataMember(Name = "given_user")]
        [Display(Name = "转赠人数")]
        public int given_user { get; set; }

        /// <summary>
        /// 过期次数
        /// </summary>
        [DataMember(Name = "expire_cnt")]
        [Display(Name = "过期次数")]
        public int expire_cnt { get; set; }

        /// <summary>
        /// 过期人数
        /// </summary>
        [DataMember(Name = "expire_user")]
        [Display(Name = "过期人数")]
        public int expire_user { get; set; }
    }

    /// <summary>
    /// 卡券统计类
    /// </summary>
    [Serializable]
    [DataContract]
    public class CommonCardStatSingleData : CommonCardStatData
    {
        /// <summary>
        /// 卡券ID
        /// </summary>
        [DataMember(Name = "card_id")]
        [Display(Name = "卡券ID")]
        public string card_id { get; set; }

        /// <summary>
        /// 卡券类型
        /// 0：折扣券，1：代金券，2：礼品券，3：优惠券，4：团购券
        /// </summary>
        [DataMember(Name = "card_type")]
        [Display(Name = "卡券类型")]
        public WechatCommonCardType card_type { get; set; }
    }

    /// <summary>
    /// 卡券统计类List
    /// </summary>
    [Serializable]
    [DataContract]
    public class CommonCardStatSingleDataList
    {
        [DataMember(Name = "list")]
        [Display(Name = "卡券统计List")]
        public List<CommonCardStatSingleData> list { get; set; }
    }

    #endregion

}
